package com.baseframe.sys.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baseframe.common.utils.PageUtils;
import com.baseframe.common.utils.R;
import com.baseframe.sys.entity.FrameOnlineMessage;
import com.baseframe.sys.service.IFrameOnlineMessageService;

/**
 * 系统用户
 * 
 * @author mzl
 */
@RestController
@RequestMapping("/sys/message")
public class FrameOnlineMessageController extends AbstractController {
	@Autowired
	private IFrameOnlineMessageService service;

	/**
	 * 首页消息列表
	 */
	@RequestMapping("/mainlist")
	public R mainlist() {
		List<FrameOnlineMessage> list = service.selectMainList(getUserguid());
		int count=service.getUnreadCount(getUserguid());
		return R.ok().put("messageList", list).put("messagecount", count);
	}
	
	/**
	 * 分页消息列表
	 */
	@RequestMapping("/list")
	public R list(@RequestParam Map<String, Object> params) {
		String userguid=getUserguid();
		PageUtils page = service.queryPage(params,userguid);
		return R.ok().put("page", page);
	}

	
}
